package cn.threewaters.qtyy.web.controller.business;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import cn.threewaters.qtyy.common.bean.ResponseJson;
import cn.threewaters.qtyy.dic.one.queryparam.QuerySjfx;
import cn.threewaters.qtyy.dic.one.queryresult.ResultSjfxCwmx;
import cn.threewaters.qtyy.dic.one.queryresult.ResultSjfxSanwen;
import cn.threewaters.qtyy.service.business.SjfxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;

@Api(tags = "数据分析")
@Controller
@RequestMapping(value = "/sjfx")
public class SjfxController {

	@Autowired
	private SjfxService sjfxService;

	@ApiIgnore
	@ApiOperation(value = "数据分析页面")
	@RequestMapping(value = "/main", method = RequestMethod.GET)
	public ModelAndView main() {
		return new ModelAndView("business/sjfx/sjfx");
	}

	@ApiOperation(value = "测温明细")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "QuerySjfx", value = "数据分析查询条件", required = true, dataType = "QuerySjfx") })
	@RequestMapping(value = "/cwmx", method = RequestMethod.GET)
	@ResponseBody
	public ResponseJson getCwmx(QuerySjfx querySjfx) throws Exception {
		Map<String, List<ResultSjfxCwmx>> queryCwmx = sjfxService.queryCwmx(querySjfx);
		return ResponseJson.builder().success(true).obj(queryCwmx).build();
	}

	@ApiOperation(value = "三温")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "QuerySjfx", value = "数据分析查询条件", required = true, dataType = "QuerySjfx") })
	@RequestMapping(value = "/sanwen", method = RequestMethod.GET)
	@ResponseBody
	public ResponseJson getSanwen(QuerySjfx querySjfx) throws Exception {
		Map<String, List<ResultSjfxSanwen>> querySanwen = sjfxService.querySanwen(querySjfx);
		return ResponseJson.builder().success(true).obj(querySanwen).build();
	}

}
